#pragma once

enum ESettings
{
  sNone,

  sLanguage,
  sLanguagePath,
  sTheme,
  sThemePath,

  sScrollThresh,
  sScrollBounceTime,
  sScrollSearchTime,

  sLongTapDelay,

  sSelectorShowTime,
  sSelectorHideTime
};

enum EThemeItems
{
  tiWindowBgColor,
  tiWindowEdgeColor,

  tiLongTapIndColor,
  tiLongTapIndFullColor,
  tiLongTapIndWidth,

  tiListScrollbarWidth,
  tiListScrollbarBgColor,
  tiListScrollbarColor,

  tiListBackground,
  tiListItemSelBackground,
  tiListItemSeparatorColor,
  tiListItemTextColor,
  tiListItemSelTextColor,
  tiListItemFont,

  tiLayoutLblFont,
  tiLayoutLblSmallFont,
  tiLayoutLblColor,
  tiLayoutLblSelColor,
  tiLayoutTextFont,
  tiLayoutIntFont,

  tiEditBoxColor,
  tiEditBoxFont,
  tiEditBoxBackground,
  tiPopupHeaderColor,
  tiPopupHeaderFont,
  tiPopupHeaderBackground,

  tiListItemIndent,
  tiListItemSize,
  tiSelectorListItemSize,

  tiLast
};

enum EThemeImages
{
  timUnknown = 0,

  timCheckboxSet,
  timCheckboxUnset,

  timFolderUp,
  timFolderRoot,

  timButtonBg,
  timButtonOk,
  timButtonCancel,
  timButtonDOk,
  timButtonDCancel,
  timButtonTabs,
  timButtonDTabs,
  timArrowLeft,
  timArrowRight,

  timSliderLeft,
  timSliderRight,
  timSliderBg,
  timSliderBar,
  timSliderDBar,

  timLast
};

enum EIniValueType
{
  ivString, ivInt, ivBool, ivColor, ivGrad, ivFont, ivPen
};

class CIniValue
{
public:
  CIniValue(int type) : m_type(type)
  {}

  virtual void Set(const TCHAR* val) = 0;

  int     m_type;
};

class CIniValueFactory
{
public:
  static CIniValue* Get(EIniValueType type, const TCHAR* val);
};

// key=string
class CIniStringValue : public CIniValue
{
public:
  CIniStringValue(const TCHAR* str) : CIniValue(ivString)
  { Set(str); }

  void Set(const TCHAR* val)
  { m_val = val; }

  CString m_val;
};

// key=123
class CIniIntValue : public CIniValue
{
public:
  CIniIntValue(const TCHAR* str) : CIniValue(ivInt), m_val(0)
  { Set(str); }

  void Set(const TCHAR* val)
  { m_val = _ttoi(val); }

  int m_val;
};

// key=yes/y/no/n
class CIniBoolValue : public CIniValue
{
public:
  CIniBoolValue(const TCHAR* str) : CIniValue(ivBool), m_val(false)
  { Set(str); }

  void Set(const TCHAR* val)
  { m_val = (_tcsicmp(val, TEXT("yes")) == 0 ||
             _tcsicmp(val, TEXT("y")) == 0); }

  bool m_val;
};

// key=ff8040
class CIniColorValue : public CIniValue
{
public:
  CIniColorValue(const TCHAR* str) : CIniValue(ivColor), m_val(0)
  { Set(str); }
  void Set(const TCHAR* val);
  COLORREF m_val;
};

// key=ff8040, 804000
class CIniGradValue : public CIniValue
{
public:
  CIniGradValue(const TCHAR* str) : CIniValue(ivGrad), m_val1(0), m_val2(0)
  { Set(str); }
  void Set(const TCHAR* val);
  COLORREF m_val1;
  COLORREF m_val2;
};

// key=Arial, 10, bold/normal, italic/normal
class CIniFontValue : public CIniValue
{
public:
  CIniFontValue(const TCHAR* str) : CIniValue(ivFont), m_bold(false), m_italic(false), m_size(10)
  { Set(str); }

  void Set(const TCHAR* val);

  CString m_name;
  bool    m_bold;
  bool    m_italic;
  int     m_size;
};

// key=ff8040, dash/null/solid, 2
class CIniPenValue : public CIniValue
{
public:
  CIniPenValue(const TCHAR* str) : CIniValue(ivPen),
    m_color(0), m_style(PS_SOLID), m_width(1)
  { Set(str); }

  void Set(const TCHAR* val);

  COLORREF m_color;
  int      m_style;
  int      m_width;
};